package com.dg11185.nearshop.net.request;

import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.HttpCacheRequest;
import com.dg11185.nearshop.net.response.CountByAreaResponse;

/**
 * 根据地区和行业统计商家数量
 * @author：Daibo    
 * @time：2014-8-21 下午4:09:56
 */
public class CountByAreaRequest extends HttpCacheRequest<CountByAreaResponse>{

    public String INDUSTRY_ID = "industryId";
    
    public CountByAreaRequest(String areaNum) {
        super(Constants.ADDRESS, Constants.countByArea);
        addParam("areaNum", areaNum);
        setWifiTimeSpan(2*24*3600*1000);
    }
    
    public CountByAreaRequest add(String key, String value){
        addParam(key, value);
        return this;
    }
    
    public CountByAreaRequest encryption(){
        addParam("chshToken", Constants.TOKEN);
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }
    
    @Override
    protected CountByAreaResponse parseJson(String response) throws Exception {
        CountByAreaResponse r = new CountByAreaResponse();
        r.parseJson(response);
        return r;
    }

}
